﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>jQuery MiniUI - 专业WebUI控件库</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="keywords" content="jquery,web,grid,表格,datagrid,js,javascript,ajax,web开发,tree,table" />   
    <meta name="description" content="jQuery MiniUI - 专业WebUI控件库。它能缩短开发时间，减少代码量，使开发者更专注于业务和服务端，轻松实现界面开发，带来绝佳的用户体验。" />
    <link href="../core.css" rel="stylesheet" type="text/css" />
    
    <link href="common.css" rel="stylesheet" type="text/css" />
</head>
<body>

    <div class="header">
        <div class="headerInner">
            <a class="logo" href="http://www.miniui.com" title="jQuery MiniUI - 专业WebUI控件库">jQuery MiniUI</a>
            <a id="why" href="/why">为什么选择MiniUI？</a>

            <ul class="topmenu">
                <li><a href="/"><span>首页</span></a></li>
                <li onmouseover="showMenu('popup1', this)" onmouseout="hideMenu('popup1', this)"><a href="/product"><span>产品</span></a>
                    <ul id="popup1" class="popupmenu">
                        <li class="product"><a href="/product">产品介绍</a></li>
                        <li><a href="/features">功能特性</a></li>
                        <li><a href="/screenshots">界面截图</a></li>                        
                        <li><a href="/support">支持服务</a></li>
                        <li><a href="/license">授权方式</a></li>
                        
                        <li class="faq"><a href="/faq">常见问题</a></li>
                    </ul>
                </li>
                <li><a href="/demo"><span>示例</span></a></li>
                <li onmouseover="showMenu('popup2', this)" onmouseout="hideMenu('popup2', this)"><a href="/docs"><span>文档</span></a>
                    <ul id="popup2" class="popupmenu">                        
                        <li id="start_link"><a href="/docs/quickstart">快速入门</a></li>
                        <li><a href="/docs/tutorial">开发教程</a></li>
                        <li id="kb_link"><a href="/docs/kb">精华文章</a></li>
                        <li><a href="/docs/api">Api参考手册</a></li>
                    </ul>
                </li>
                <li><a href="/bbs"><span>论坛</span></a></li><li><a href="/download"><span>下载</span></a></li>
                
                <li><a href="/contact"><span>联系</span></a></li>
            </ul>
        
     
        </div>
    </div>
    <div class="topnav">
        <div class="topnavInner">
            <a href="/">首页</a>><a href="/docs">文档中心</a>><a href="/docs/tutorial">开发教程</a>><span>TreeGrid</span>
        </div>
    </div>
    <div class="body " >
        <div class="bodyInner">
            
        <div class="contentView">
            <h3>TreeGrid</h3>
            
            <a title="TreeGrid 树形表格" href="../../demo/treegrid/treegrid.html" target="_blank"><img src="../api/images/treegrid.gif" /></a>

            <br /><br />
            <p class="p_demo"><span class="note">参考示例</span>：
                <a href="../../demo/treegrid/treegrid.html" target="_blank">TreeGrid</a>&nbsp;&nbsp;&nbsp; 
                </p>
            <br />

            <h4>创建TreeGrid</h4>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: maroon">div </span><span style="color: red">id</span><span style="color: blue">="treegrid1" </span><span style="color: red">class</span><span style="color: blue">="mini-treegrid" </span><span style="color: red">style</span><span style="color: blue">="</span><span style="color: red">width</span><span style="color: blue">:600px;</span><span style="color: red">height</span><span style="color: blue">:280px;"     
    </span><span style="color: red">url</span><span style="color: blue">="../data/tasks.txt" </span><span style="color: red">showTreeIcon</span><span style="color: blue">="true" 
    </span><span style="color: red">treeColumn</span><span style="color: blue">="taskname" </span><span style="color: red">idField</span><span style="color: blue">="UID" </span><span style="color: red">parentField</span><span style="color: blue">="ParentTaskUID" </span><span style="color: red">resultAsTree</span><span style="color: blue">="false"
&gt;
    &lt;</span><span style="color: maroon">div </span><span style="color: red">property</span><span style="color: blue">="columns"&gt;
        &lt;</span><span style="color: maroon">div </span><span style="color: red">type</span><span style="color: blue">="indexcolumn"&gt;&lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
        &lt;</span><span style="color: maroon">div </span><span style="color: red">name</span><span style="color: blue">="taskname" </span><span style="color: red">field</span><span style="color: blue">="Name" </span><span style="color: red">width</span><span style="color: blue">="200"&gt;</span>任务名称<span style="color: blue">&lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
        &lt;</span><span style="color: maroon">div </span><span style="color: red">field</span><span style="color: blue">="Duration" </span><span style="color: red">width</span><span style="color: blue">="100"&gt;</span>工期<span style="color: blue">&lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
        &lt;</span><span style="color: maroon">div </span><span style="color: red">field</span><span style="color: blue">="Start" </span><span style="color: red">width</span><span style="color: blue">="100" </span><span style="color: red">dateFormat</span><span style="color: blue">="yyyy-MM-dd"&gt;</span>开始日期<span style="color: blue">&lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
        &lt;</span><span style="color: maroon">div </span><span style="color: red">field</span><span style="color: blue">="Finish" </span><span style="color: red">width</span><span style="color: blue">="100" </span><span style="color: red">dateFormat</span><span style="color: blue">="yyyy-MM-dd"&gt;</span>完成日期<span style="color: blue">&lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
</span></pre>
            <p><span class="note">注意</span>：idField、parentField、resultAsTree属性。</p>
        
            <h4>数据结构：列表</h4>
            <p>通过url返回的数据结构如下：</p>
<pre class="code">[
    {id: "base", text: "Base", expanded: false},    
    {id: "ajax", text: "Ajax", pid: "base"},
    {id: "json", text: "JSON", pid: "base"},
    ......
]
</pre>
            <p>其中，id和pid对应父子关系。</p>

            <h4>Columns列配置</h4>
            <p>TreeGrid的列配置，跟DataGrid类似。参考如下：</p>
<table>
        <tr><th>Name</th><th>Type</th><th>Description</th><th>Default</th></tr>
        
        <tr>
            <td>header</td>
            <td>String</td>
            <td>表头列文本</td>
            <td></td>
        </tr>  
        <tr>
            <td>field</td>
            <td>String</td>
            <td>单元格值字段</td>
            <td></td>
        </tr>  
        <tr>
            <td>name</td>
            <td>String</td>
            <td>列标识名称</td>
            <td></td>
        </tr> 
        <tr>
            <td>width</td>
            <td>Number</td>
            <td>列宽度</td>
            <td></td>
        </tr>  
        <tr>
            <td>headerAlign</td>
            <td>String</td>
            <td>表头列文本位置。left/center/right。</td>
            <td>left</td>
        </tr>  
        <tr>
            <td>align</td>
            <td>String</td>
            <td>单元格文本位置。left/center/right。</td>
            <td>left</td>
        </tr>  
        <tr>
            <td>headerCls</td>
            <td>String</td>
            <td>表头列样式类。</td>
            <td></td>
        </tr>  
        <tr>
            <td>cellCls</td>
            <td>String</td>
            <td>单元格样式类</td>
            <td></td>
        </tr>  
        <tr>
            <td>headerStyle</td>
            <td>String</td>
            <td>表头列样式</td>
            <td></td>
        </tr>  
        <tr>
            <td>cellStyle</td>
            <td>String</td>
            <td>单元格样式</td>
            <td></td>
        </tr>        
        <tr>
            <td>editor</td>
            <td>Object</td>
            <td>单元格编辑器。</td>
            <td></td>
        </tr>
        <tr>
            <td>renderer</td>
            <td>Function</td>
            <td>单元格绘制处理函数，同<a href="#drawcell">drawcell</a>事件。</td>
            <td></td>
        </tr>
        <tr>
            <td>allowMove</td>
            <td>Boolean</td>
            <td>是否可移动表头列。</td>
            <td>true</td>
        </tr>
        <tr>
            <td>allowResize</td>
            <td>Boolean</td>
            <td>是否拖拽调节表头列宽度。</td>
            <td>true</td>
        </tr>
    </table>

        </div>
            
        </div>
    </div>
    <div class="footer">
        <div class="footerInner">
            <div id="copyright">Copyright © 上海普加软件有限公司版权所有 </div>
            <div id="bottomlinks"><a href="/sitemap">网站导航</a>|<a href="/support">支持服务</a>|<a href="/license">授权方式</a>|<a href="/contact">联系我们</a></div>
        </div>
    </div>
</body>
</html>
